package com.cty.LinkedList;

public class question01 {
    //统计单链表的有效节点
    public static int size(heroNode head){
        if(head.next==null){
            return 0;
        }
        heroNode temp=head.next;//辅助指针
        int length=0;//长度
        while(temp!=null){
            length++;
            temp=temp.next;
        }
        return length;
    }
}
